﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DotNet.Random.Mobile
{
    /// <summary>
    /// 中国大陆手机号随机类，实现了接口IStringRandService
    /// </summary>
    public class ChinaMainlandNumRandService : DotNet.Random.Interface.IStringRandService
    {
        /// <summary>
        /// Rands this instance.
        /// 随机生成字符串方法
        /// 映射到虚方法中，扩展时，可重写
        /// </summary>
        /// <returns>
        /// 返回字符串类型
        /// </returns>
        public virtual string Rand()
        {
            var num = new List<int>();

            #region preffix rand

            var preffixRand = new ChinaMainlandSuffixRandService();
            num.Add(preffixRand.Rand());

            #endregion

            #region suffix rand

            var suffixRand = new Int.TenNumberRandService();
            for (int i = 0; i < 8; i++)
            {
                num.Add(suffixRand.Rand());
                System.Threading.Thread.Sleep(200);
            }

            #endregion

            var res = string.Join("", num);

            return res;
        }
    }
}
